package com.example.star.api_service;

import com.example.star.entity.ShoppingCart;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiShoppingCart {
    @POST("shopping_carts")
    Call<ShoppingCart> saveShoppingCart(@Body ShoppingCart shoppingCart);
    @GET("shopping_carts")
    Call<List<ShoppingCart>> getShoppingCarts();
    // 根据用户名查询购物车数据
    @GET("shopping_carts/items-by-user")
    Call<List<ShoppingCart>> getShoppingCartsByuserName(@Query("userName") String userName);

    @DELETE("shopping_carts/{id}")
    Call<Void> deleteShoppingCartById(@Path("id") int id);

    @DELETE("shopping_carts/delete_userId")
    Call<Void> deleteShoppingCartByUserId(@Query("userName") String userName, @Query("title") String title);

    @GET("shopping_carts/check")
    Call<Boolean> checkFShoppingCart(@Query("userName") String userName, @Query("title") String title);

}
